package ooday03;

public class Test {
    public static void main(String[] args) {
        Dog dog=new Dog("小黑",2,"黑");
        System.out.println(dog.name);
        dog.name=null;
        System.out.println(dog.name);//空指针

        /*
        Dog[] dogs=new Dog[3];
        dogs[0]=new Dog("小黑",2,"黑");
        dogs[1]=new Dog("小黄",2,"黄");
        dogs[2]=new Dog("小白",2,"白");
        System.out.println(dogs[0].name);
        dogs[1].swim();//游泳
        for (int i=0;i<dogs.length;i++){
            System.out.println(dogs[i].name);
            dogs[i].eat();
        }
        Chick[] chicks=new Chick[4];
        chicks[0]=new Chick("小花",2,"花");
        chicks[1]=new Chick("小鸡",2,"棕");
        chicks[2]=new Chick("小鸟",2,"彩");
        for (int i=0;i<chicks.length;i++){
            System.out.println(chicks[i].name);
            chicks[i].eat();
        }
        Fish[] fish=new Fish[2];
        fish[0]=new Fish("小金",2,"金");
        fish[1]=new Fish("小红",1,"红");
        for (int i=0;i<fish.length;i++){
            System.out.println(fish[i].name);
            fish[i].eat();
        }*/
    }


}
